package ru.mirent;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.mirent.entity.notifications.AfterAllNotification;
import ru.mirent.entity.notifications.AfterEachNotification;
import ru.mirent.entity.notifications.BeforeAllNotification;
import ru.mirent.entity.notifications.BeforeEachNotification;
import ru.mirent.entity.executors.SyncMultipleJob;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
import ru.mirent.entity.listeners.platform.ExtensionCallbackLifecycle;
import ru.mirent.entity.listeners.platform.FixtureObserverService;

@ExtendWith(ExtensionCallbackLifecycle.class)
public class BaseSuit {
    // TODO Использовать данное объявление во всем проетке
    private static final Logger LOG = LoggerFactory.getLogger(BaseSuit.class);
    public static FixtureObserverService fixtureObserverService = new FixtureObserverService("TEST_ONE");

    @BeforeAll
    static void beforeAll() {
        fixtureObserverService.registerObserver(new SyncMultipleJob(AfterEachNotification.class));
        fixtureObserverService.sendAction(BeforeAllNotification.class);
        LOG.info("FARADENZA");
    }

    @AfterAll
    static void afterAll() {
        fixtureObserverService.sendAction(AfterAllNotification.class);
    }

    @BeforeEach
    void beforeEach() {
        fixtureObserverService.sendAction(BeforeEachNotification.class);
    }

    @AfterEach
    void afterEach() {
        fixtureObserverService.sendAction(AfterEachNotification.class);
    }
}
